package com.gitee.huanminabc.utils_test.enums;

import lombok.Getter;

@Getter
public enum AuthEnum {
    ILLEGAL_TOKEN(10001, "非法token!"),
    TOKEN_EXPIRED(10002, "token已过期!"),
    REDIS_USER_NOT_EXIST(10003, "redis用户不存在!"),
    NO_REFRESH_TOKEN(10004, "没有refreshToken!"),
    NOT_PAST_DUE_TOKEN(10005, "token未过期!"),
    REFRESH_EXPIRED(10006, "refreshToken已过期!"),
    ;

    private Integer code;
    private String msg;

    AuthEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    //根据co

    //根据ILLEGAL_TOKEN-msg拼接
    public String getShow() {
        return this + "-" + this.getMsg();
    }

    //判断字符串是否有this-
    public static boolean isShow(String str) {
        if (str == null) {
            return false;
        }
        for (AuthEnum value : AuthEnum.values()) {
            if (str.startsWith(value + "-")) {
                return true;
            }
        }
        return false;
    }
}
